﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ogsadai.org.uk/namespaces/2005/10/types" xmlns:gds="http://ogsadai.org.uk/namespaces/2005/10/types" xmlns:gdstypes="http://ogsadai.org.uk/namespaces/2005/10/types" xmlns:tns="http://ogsadai.org.uk/namespaces/2005/10/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:complexType name="ExtensibilityType">
    <xsd:sequence>
      <xsd:any namespace="##any" />
    </xsd:sequence>
  </xsd:complexType>
  <!-- Base activity types -->
  <xsd:simpleType name="DocumentationType">
    <xsd:restriction base="xsd:string" />
  </xsd:simpleType>
  <xsd:complexType abstract="false" name="ActivityType">
    <xsd:annotation>
      <xsd:documentation>
        Forms the base of all activities. Simply
        makes sure that each activity has a name.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="documentation" type="tns:DocumentationType" />
    </xsd:sequence>
    <xsd:attribute name="name" type="xsd:ID" use="required" />
  </xsd:complexType>
  <xsd:element name="activity" type="tns:ActivityType">
    <xsd:annotation>
      <xsd:documentation>
        The basic activity which, through a substitution 
        group allows requests to include activities that 
        are not defined in this schema.
       </xsd:documentation>
    </xsd:annotation>
  </xsd:element>
  <!-- 
     I/O stream types. These types are extended to describe the input 
     and output streams of an activity
   -->
  <xsd:complexType abstract="false" mixed="true" name="ActivityInputType">
    <xsd:annotation>
      <xsd:documentation>
        Activity input forms the base of a named element
        that provides an untyped input stream into the activity.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence />
    <xsd:attribute name="from" type="xsd:IDREF" use="optional" />
  </xsd:complexType>
  <xsd:complexType abstract="false" mixed="true" name="ActivityOutputType">
    <xsd:annotation>
      <xsd:documentation>
        Activity output forms the base of a named element
        that provides an untyped output stream from the activity.
        This base element defines a sequent of "any" elements so that
        default output data can be defined, e.g. in the "value" output
        of the parameter activity.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##any" processContents="lax" />
    </xsd:sequence>
    <xsd:attribute name="name" type="xsd:ID" use="required" />
  </xsd:complexType>
  <!-- Perform document types -->
  <xsd:complexType name="PerformType">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="documentation" type="tns:DocumentationType" />
      <xsd:element maxOccurs="1" minOccurs="0" name="session" type="tns:SessionType" />
      <xsd:choice maxOccurs="unbounded" minOccurs="0">
        <xsd:element ref="tns:activity" />
        <xsd:element ref="tns:sequence" />
        <xsd:element ref="tns:flow" />
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="perform" type="tns:PerformType">
    <xsd:annotation>
      <xsd:documentation>
        The document that is passed into the Perform operation.
      </xsd:documentation>
    </xsd:annotation>
  </xsd:element>
  <xsd:element name="sequence">
    <xsd:complexType>
      <xsd:annotation>
        <xsd:documentation>
          A sequence element describes a number of entities that should be
          processed by the engine in sequential order. A sequence element 
          can contain a sequence of sub-elements where each is either 
          an activity, another sequence or a flow.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:choice maxOccurs="unbounded" minOccurs="0">
        <xsd:element ref="tns:activity" />
        <xsd:element ref="tns:sequence" />
        <xsd:element ref="tns:flow" />
      </xsd:choice>
      <xsd:attribute name="name" type="xsd:ID" use="required" />
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="flow">
    <xsd:complexType>
      <xsd:annotation>
        <xsd:documentation>
          A flow element describes a number of entities that should be
          processed by the engine in parallel. A flow element can contain 
          number of elements where each is either an activity, a flow or 
          a sequence.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:choice maxOccurs="unbounded" minOccurs="0">
        <xsd:element ref="tns:activity" />
        <xsd:element ref="tns:sequence" />
        <xsd:element ref="tns:flow" />
      </xsd:choice>
      <xsd:attribute name="name" type="xsd:ID" use="required" />
    </xsd:complexType>
  </xsd:element>
  <!-- Response document types -->
  <xsd:simpleType name="StatusType">
    <xsd:annotation>
      <xsd:documentation>
        Enumeration of the possible states of an activity or request.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="UNSTARTED" />
      <xsd:enumeration value="INITIALISING" />
      <xsd:enumeration value="PROCESSING" />
      <xsd:enumeration value="COMPLETED" />
      <xsd:enumeration value="TIMEDOUT" />
      <xsd:enumeration value="TERMINATED" />
      <xsd:enumeration value="ERROR" />
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:complexType mixed="true" name="RequestType">
    <xsd:annotation>
      <xsd:documentation>
        Describes the status of a request.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:any minOccurs="0" namespace="##any" />
    </xsd:sequence>
    <xsd:attribute name="cause" type="xsd:string" use="optional" />
    <xsd:attribute name="status" type="tns:StatusType" use="required" />
  </xsd:complexType>
  <xsd:complexType mixed="true" name="ResultType">
    <xsd:annotation>
      <xsd:documentation>
        Wraps the results from one activity.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:any minOccurs="0" namespace="##any" />
    </xsd:sequence>
    <xsd:attribute name="name" type="xsd:string" use="required" />
    <xsd:attribute name="status" type="tns:StatusType" use="required" />
  </xsd:complexType>
  <!-- Response document types. -->
  <xsd:element name="response" type="tns:ResponseType" />
  <xsd:complexType name="ResponseType">
    <xsd:annotation>
      <xsd:documentation>
        The document that is returned from the Perform operation.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element maxOccurs="1" minOccurs="1" name="session" type="tns:SessionType" />
      <xsd:element maxOccurs="1" minOccurs="1" name="request" type="tns:RequestType" />
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="result" type="tns:ResultType" />
    </xsd:sequence>
  </xsd:complexType>
  <!-- Type used for specifying the session requirements of 
       a perform document. -->
  <xsd:complexType name="SessionType">
    <xsd:attribute name="id" type="xsd:ID" use="optional" />
    <xsd:attribute name="timeout" type="xsd:long" use="optional" />
    <xsd:attribute name="mode" type="tns:SessionMode" use="optional" />
  </xsd:complexType>
  <xsd:simpleType name="SessionMode">
    <xsd:annotation>
      <xsd:documentation>
        The mode attribute value can be used to instruct a session to terminate.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="terminate" />
    </xsd:restriction>
  </xsd:simpleType>
  <!-- Complex type for xslTransform element -->
  <xsd:complexType name="XSLTransformType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="inputXSLT">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityInputType">
                  <xsd:sequence>
                    <xsd:any maxOccurs="1" minOccurs="0" namespace="http://www.w3.org/1999/XSL/Transform" processContents="lax" />
                  </xsd:sequence>
                </xsd:extension>
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="inputXML">
            <xsd:complexType mixed="true">
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="output">
            <xsd:complexType mixed="true">
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- xslTransform element -->
  <xsd:element name="xslTransform" substitutionGroup="gds:activity" type="gds:XSLTransformType" />
  <!-- Output Stream -->
  <xsd:complexType name="InputStreamType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="toLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="inputStream" substitutionGroup="gds:activity" type="gds:InputStreamType" />
  <!-- Deliver From URL -->
  <xsd:complexType name="DeliverFromURLType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromURL">
            <xsd:complexType>
              <xsd:simpleContent>
                <xsd:extension base="xsd:anyURI">
                  <xsd:attribute name="blockSizeInBytes" type="xsd:integer" use="optional" />
                </xsd:extension>
              </xsd:simpleContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="toLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="deliverFromURL" substitutionGroup="gds:activity" type="gds:DeliverFromURLType" />
  <!-- Deliver To SMTP -->
  <xsd:complexType name="DeliverToSMTPType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="unbounded" minOccurs="1" name="to">
            <xsd:simpleType>
              <xsd:annotation>
                <xsd:documentation>The e-mail address of the intended recipient.</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string" />
            </xsd:simpleType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="from">
            <xsd:simpleType>
              <xsd:annotation>
                <xsd:documentation>The e-mail address of the named sender.</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string" />
            </xsd:simpleType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="subject">
            <xsd:simpleType>
              <xsd:annotation>
                <xsd:documentation>The subject of the e-mail.</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string" />
            </xsd:simpleType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="server">
            <xsd:simpleType>
              <xsd:annotation>
                <xsd:documentation>The SMTP server to use to send the e-mail.</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string" />
            </xsd:simpleType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="deliverToSMTP" substitutionGroup="gds:activity" type="gds:DeliverToSMTPType" />
  <!-- import the types schema -->
  <!-- relative location of schema on server - assumes that this schema is placed in the activities directory -->
  <!-- The name of the type should be changed to avoid conflicts -->
  <xsd:complexType name="BlockAggregatorType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <!-- Define the input(s) the activity requires (or can use) -->
          <xsd:element maxOccurs="1" minOccurs="1" name="input" type="gdstypes:ActivityInputType" />
          <!-- Define what configuration data the activity needs to execute -->
          <xsd:element maxOccurs="1" minOccurs="1" name="blocksize">
            <xsd:complexType>
              <xsd:attribute name="size" use="required">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:positiveInteger" />
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <!-- Define the output(s) the activity provides -->
          <xsd:element maxOccurs="1" minOccurs="1" name="output" type="gdstypes:ActivityOutputType" />
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="blockAggregator" substitutionGroup="gdstypes:activity" type="tns:BlockAggregatorType" />
  <!-- Deliver To GDT -->
  <xsd:complexType name="DeliverToGDTType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="toGDT">
            <xsd:complexType>
              <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                  <xsd:attribute name="streamId" type="xsd:string" use="required" />
                  <xsd:attribute name="resourceName" type="xsd:string" use="required" />
                  <xsd:attribute name="authentication" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="privacy" />
                        <xsd:enumeration value="integrity" />
                        <xsd:enumeration value="signature" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="delegation" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="full" />
                        <xsd:enumeration value="limited" />
                        <xsd:enumeration value="none" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="authorization" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="host" />
                        <xsd:enumeration value="self" />
                        <xsd:enumeration value="none" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="mode" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="full" />
                        <xsd:enumeration value="block" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                </xsd:extension>
              </xsd:simpleContent>
            </xsd:complexType>
          </xsd:element>
          <!-- ACH commented out - will add again later 
                    <xsd:element name="securityConfig" minOccurs="0" maxOccurs="1">
                       <xsd:sequence>
                           <xsd:any minOccurs="0"/>
                       </xsd:sequence>
                    </xsd:element>
   					-->
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="deliverToGDT" substitutionGroup="gds:activity" type="gds:DeliverToGDTType" />
  <!-- Import general OGSA-DAI types. -->
  <!-- Define the type for the activity element.
  The value of the name attribute should be unique. -->
  <xsd:complexType name="GetNetCDFDataActivityType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <!-- Define any configuration elements for the activity. -->
            <xsd:element name="range">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="min" type="xsd:string" use="required" />
                <xsd:attribute name="max" type="xsd:string" use="required" />
                <xsd:attribute name="step" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="value">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="value" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <!-- Define the output element(s) for the activity. -->
            <xsd:element name="output">
              <xsd:complexType mixed="true">
                <xsd:complexContent mixed="true">
                  <xsd:extension base="gds:ActivityOutputType" />
                </xsd:complexContent>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="getNetCDFData" substitutionGroup="gdstypes:activity" type="tns:GetNetCDFDataActivityType" />
  <!-- Import general OGSA-DAI types. -->
  <!-- Define the type for the activity element.
  The value of the name attribute should be unique. -->
  <xsd:complexType name="GetXmlDataActivityType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <!-- Define any configuration elements for the activity. -->
            <xsd:element name="range">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="min" type="xsd:string" use="required" />
                <xsd:attribute name="max" type="xsd:string" use="required" />
                <xsd:attribute name="step" type="xsd:string" />
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="value">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="value" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <!-- Define the output element(s) for the activity. -->
            <xsd:element name="output">
              <xsd:complexType mixed="true">
                <xsd:complexContent mixed="true">
                  <xsd:extension base="gds:ActivityOutputType" />
                </xsd:complexContent>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="getXmlData" substitutionGroup="gdstypes:activity" type="tns:GetXmlDataActivityType" />
  <!-- Import general OGSA-DAI types. -->
  <!-- Define the type for the activity element.
  The value of the name attribute should be unique. -->
  <xsd:complexType name="GetCdmDataActivityType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <!-- Define any configuration elements for the activity. -->
            <xsd:element name="range">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="min" type="xsd:string" use="required" />
                <xsd:attribute name="max" type="xsd:string" use="required" />
                <xsd:attribute name="step" type="xsd:string" />
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="value">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="value" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <!-- Define the output element(s) for the activity. -->
            <xsd:element name="output">
              <xsd:complexType mixed="true">
                <xsd:complexContent mixed="true">
                  <xsd:extension base="gds:ActivityOutputType" />
                </xsd:complexContent>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="getCdmData" substitutionGroup="gdstypes:activity" type="tns:GetCdmDataActivityType" />
  <!-- Define the type for the activity element.
  The value of the name attribute should be unique. -->
  <xsd:complexType name="GetGranuleActivityType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <!-- Define any configuration elements for the activity. -->
            <xsd:element name="range">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="min" type="xsd:string" use="required" />
                <xsd:attribute name="max" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="value">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="value" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <!-- Define the output element(s) for the activity. -->
            <xsd:element name="output">
              <xsd:complexType mixed="true">
                <xsd:complexContent mixed="true">
                  <xsd:extension base="gds:ActivityOutputType" />
                </xsd:complexContent>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="getGranule" substitutionGroup="gdstypes:activity" type="tns:GetGranuleActivityType" />
  <!-- Import general OGSA-DAI types. -->
  <!-- Define the type for the activity element.
  The value of the name attribute should be unique. -->
  <xsd:complexType name="GetMetaDataActivityType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <!-- Define any configuration elements for the activity. -->
            <xsd:element name="range">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="min" type="xsd:string" use="required" />
                <xsd:attribute name="max" type="xsd:string" use="required" />
                <xsd:attribute name="step" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="value">
              <xsd:complexType>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="value" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
            <!-- Define the output element(s) for the activity. -->
            <xsd:element name="output">
              <xsd:complexType mixed="true">
                <xsd:complexContent mixed="true">
                  <xsd:extension base="gds:ActivityOutputType" />
                </xsd:complexContent>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="getMetaData" substitutionGroup="gdstypes:activity" type="tns:GetMetaDataActivityType" />
  <!-- Deliver From GDT -->
  <xsd:complexType name="DeliverFromGDTType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromGDT">
            <xsd:complexType>
              <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                  <xsd:attribute name="streamId" type="xsd:string" use="required" />
                  <xsd:attribute name="resourceName" type="xsd:string" use="required" />
                  <xsd:attribute name="authentication" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="privacy" />
                        <xsd:enumeration value="integrity" />
                        <xsd:enumeration value="signature" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="delegation" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="full" />
                        <xsd:enumeration value="limited" />
                        <xsd:enumeration value="none" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="authorization" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="host" />
                        <xsd:enumeration value="self" />
                        <xsd:enumeration value="none" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="mode" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="full" />
                        <xsd:enumeration value="block" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="numberOfBlocks" type="xsd:int" use="optional" />
                </xsd:extension>
              </xsd:simpleContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="toLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>
                               A local named endpoint.
                            </xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <!-- ACH commented out - will add again later 
                   <xsd:element name="securityConfig" minOccurs="0" maxOccurs="1">
                       <xsd:sequence>
                           <xsd:any minOccurs="0"/>
                       </xsd:sequence>
                   </xsd:element>
                   -->
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="deliverFromGDT" substitutionGroup="gds:activity" type="gds:DeliverFromGDTType" />
  <!-- Complex type for gzipCompression element -->
  <xsd:complexType name="GZIPCompressionType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element minOccurs="0" name="settings">
            <xsd:complexType>
              <xsd:attribute name="checksum" use="optional">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="adler32" />
                    <xsd:enumeration value="crc32" />
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="input">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="compressedOutput">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="metadataOutput">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- zipTransform Element -->
  <xsd:element name="gzipCompression" substitutionGroup="gds:activity" type="gds:GZIPCompressionType" />
  <!-- Complex type for zipArchive element -->
  <xsd:complexType name="ZIPArchiveType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element minOccurs="0" name="comment" type="xsd:string" />
          <xsd:element minOccurs="0" name="settings">
            <xsd:complexType>
              <xsd:attribute name="checksum" use="optional">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="adler32" />
                    <xsd:enumeration value="crc32" />
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:attribute>
              <xsd:attribute name="level" use="optional">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:integer">
                    <xsd:minInclusive value="0" />
                    <xsd:maxInclusive value="9" />
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="unbounded" name="zipEntry">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="archivedOutput">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="metadataOutput">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- zipTransform Element -->
  <xsd:element name="zipArchive" substitutionGroup="gds:activity" type="gds:ZIPArchiveType" />
  <!-- Output Stream -->
  <xsd:complexType name="OutputStreamType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="outputStream" substitutionGroup="gds:activity" type="gds:OutputStreamType" />
  <!--
    Import the schema containing the basic grid data service types.
    Note: the schemaLoaction attribute is currently set to a relative 
    location that assumes this file is placed in the activities schema 
    directory.
  -->
  <!--
    Describe the structure of the stringTokenizer element by defining
    a complex type named StringTokenizerType.
  -->
  <xsd:complexType name="StringTokenizerType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <!-- The stream of input data to tokenize. -->
          <xsd:element maxOccurs="1" minOccurs="1" name="stringBlocksInput">
            <xsd:complexType mixed="true">
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <!-- The delimiter(s) to tokenize around. -->
          <xsd:element maxOccurs="1" minOccurs="0" name="delimiters">
            <xsd:complexType>
              <xsd:attribute name="value" use="required">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string" />
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <!-- The stream of output tokens that the activity will generate. -->
          <xsd:element maxOccurs="1" minOccurs="1" name="stringTokensOutput">
            <xsd:complexType>
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- 
    Define the stringTokenizer activity element and reference the
    StringTokenizerType described above.
  -->
  <xsd:element name="stringTokenizer" substitutionGroup="gds:activity" type="gds:StringTokenizerType" />
  <!-- Import general OGSA-DAI types. -->
  <!-- Define the type for the activity element.
  The value of the name attribute should be unique. -->
  <xsd:complexType name="ConditionType">
    <xsd:choice>
      <xsd:element name="and" type="tns:AndType" />
      <xsd:element name="or" type="tns:OrType" />
      <xsd:element name="shift" type="tns:ShiftType" />
      <xsd:element name="simpleFuzzyRequest" type="tns:SimpleFuzzyType" />
    </xsd:choice>
    <xsd:attribute name="logic" type="xsd:string" use="optional" />
  </xsd:complexType>
  <xsd:complexType name="SimpleFuzzyType">
    <xsd:sequence>
      <!-- <xsd:choice minOccurs="0" maxOccurs="unbounded"> -->
      <!-- Define any configuration elements for the activity. -->
      <xsd:element maxOccurs="1" minOccurs="1" name="dataRequest">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="parameter" type="xsd:string" />
            <xsd:element maxOccurs="1" minOccurs="0" name="level" type="xsd:string" />
            <xsd:element name="coordinates">
              <xsd:complexType>
                <xsd:choice>
                  <xsd:element maxOccurs="unbounded" name="latlon">
                    <xsd:complexType>
                      <xsd:sequence>
                        <xsd:element maxOccurs="1" minOccurs="1" name="lat" type="xsd:string" />
                        <xsd:element maxOccurs="1" minOccurs="1" name="lon" type="xsd:string" />
                      </xsd:sequence>
                    </xsd:complexType>
                  </xsd:element>
                  <xsd:element maxOccurs="unbounded" name="station" type="xsd:string" />
                </xsd:choice>
              </xsd:complexType>
            </xsd:element>
            <xsd:element maxOccurs="1" minOccurs="1" name="times">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element maxOccurs="unbounded" minOccurs="1" name="time">
                    <xsd:complexType>
                      <xsd:sequence>
                        <xsd:element name="dayIdFrom" type="xsd:string" />
                        <xsd:element name="dayIdTo" type="xsd:string" />
                      </xsd:sequence>
                    </xsd:complexType>
                  </xsd:element>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element maxOccurs="1" minOccurs="1" name="sampling" type="xsd:string" />
            <xsd:element maxOccurs="1" minOccurs="0" name="average" type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element maxOccurs="1" name="term" type="xsd:string" />
      <xsd:element maxOccurs="1" name="treshold1" type="xsd:string" />
      <xsd:element maxOccurs="1" name="treshold2" type="xsd:string" />
      <xsd:element maxOccurs="1" name="importance" type="xsd:string" />
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="FuzzyActivityType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <xsd:element name="search" type="tns:ConditionType" />
          <!--xsd:element name="input">
						<xsd:complexType mixed="true">
							<xsd:complexContent mixed="true">
								<xsd:extension base="gds:ActivityInputType"/>
							</xsd:complexContent>
						</xsd:complexType>
					</xsd:element-->
          <!-- Define the output element(s) for the activity. -->
          <xsd:element name="output">
            <xsd:complexType mixed="true">
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <!--</xsd:choice> -->
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:complexType name="AndType">
    <!--<xsd:sequence>
			<xsd:element type="tns:ConditionType" minOccurs="2" maxOccurs="unbounded"/>
		</xsd:sequence>-->
    <xsd:sequence maxOccurs="unbounded" minOccurs="2">
      <xsd:choice maxOccurs="1" minOccurs="1">
        <!--<xsd:element type="tns:ConditionType" minOccurs="2" maxOccurs="unbounded"/>-->
        <xsd:element name="and" type="tns:AndType" />
        <xsd:element name="or" type="tns:OrType" />
        <xsd:element name="shift" type="tns:ShiftType" />
        <xsd:element name="simpleFuzzyRequest" type="tns:SimpleFuzzyType" />
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="OrType">
    <xsd:sequence maxOccurs="unbounded" minOccurs="2">
      <xsd:choice maxOccurs="1" minOccurs="1">
        <!--<xsd:element type="tns:ConditionType" minOccurs="2" maxOccurs="unbounded"/>-->
        <xsd:element name="and" type="tns:AndType" />
        <xsd:element name="or" type="tns:OrType" />
        <xsd:element name="shift" type="tns:ShiftType" />
        <xsd:element name="simpleFuzzyRequest" type="tns:SimpleFuzzyType" />
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="ShiftType">
    <xsd:sequence>
      <xsd:element maxOccurs="1" minOccurs="1" name="steps" type="xsd:integer" />
      <xsd:choice maxOccurs="1" minOccurs="1">
        <!--<xsd:element type="tns:ConditionType" minOccurs="2" maxOccurs="unbounded"/>-->
        <xsd:element name="and" type="tns:AndType" />
        <xsd:element name="or" type="tns:OrType" />
        <xsd:element name="shift" type="tns:ShiftType" />
        <xsd:element name="simpleFuzzyRequest" type="tns:SimpleFuzzyType" />
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <!--<xsd:complexType name="FuzzyActivityType">
		<xsd:sequence>
			<xsd:element name="search" type="ConditionType" minOccurs="1" maxOccurs="1"/>
		</xsd:sequence>
	</xsd:complexType>-->
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="fuzzy" substitutionGroup="gdstypes:activity" type="tns:FuzzyActivityType" />
  <!-- import the types schema -->
  <!-- relative location of schema on server - assumes that this schema is placed in the activities directory -->
  <xsd:complexType name="NotificationType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <!-- The type of notifications we want to receive -->
          <xsd:element maxOccurs="1" minOccurs="0" name="notify">
            <xsd:complexType mixed="true">
              <xsd:attribute name="type" use="required">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="complete" />
                    <xsd:enumeration value="commenced" />
                    <xsd:enumeration value="none" />
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <!-- The data input stream -->
          <xsd:element maxOccurs="1" minOccurs="1" name="dataInput">
            <xsd:complexType mixed="true">
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <!-- The data output stream -->
          <xsd:element maxOccurs="1" minOccurs="1" name="dataOutput">
            <xsd:complexType>
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <!-- The notification message output stream -->
          <xsd:element maxOccurs="1" minOccurs="1" name="notificationOutput">
            <xsd:complexType>
              <xsd:complexContent mixed="true">
                <xsd:extension base="gds:ActivityOutputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <!-- The message to stick on the notification message output stream -->
          <xsd:element default="" name="message" type="xsd:string" />
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="notification" substitutionGroup="gds:activity" type="gds:NotificationType" />
  <!-- Import general OGSA-DAI types. -->
  <!-- Define the type for the activity element.
       The value of the name attribute should be unique. -->
  <xsd:complexType name="DemoExternalInputType">
    <xsd:complexContent>
      <xsd:extension base="gdstypes:ActivityType">
        <xsd:sequence>
          <!-- Define any configuration elements for the activity. -->
          <xsd:element maxOccurs="1" minOccurs="1" name="nInputBlocks">
            <xsd:complexType>
              <xsd:attribute name="value" use="required">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:integer" />
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="streamName">
            <xsd:complexType>
              <xsd:attribute name="value" use="required">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string" />
                </xsd:simpleType>
              </xsd:attribute>
            </xsd:complexType>
          </xsd:element>
          <!-- Define the output element(s) for the activity. -->
          <xsd:element maxOccurs="1" minOccurs="1" name="myOutput" type="gdstypes:ActivityOutputType" />
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <!-- Define the name the activity will take on in the perform documents -->
  <xsd:element name="demoExternalInput" substitutionGroup="gdstypes:activity" type="tns:DemoExternalInputType" />
  <!-- Output Stream -->
  <xsd:complexType name="DeliverToStreamType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="deliverToStream" substitutionGroup="gds:activity" type="gds:DeliverToStreamType" />
  <!-- Deliver To URL -->
  <xsd:complexType name="DeliverToURLType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="fromLocal">
            <xsd:complexType mixed="true">
              <xsd:annotation>
                <xsd:documentation>A local named endpoint.</xsd:documentation>
              </xsd:annotation>
              <xsd:complexContent>
                <xsd:extension base="gds:ActivityInputType" />
              </xsd:complexContent>
            </xsd:complexType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="1" name="toURL">
            <xsd:simpleType>
              <xsd:annotation>
                <xsd:documentation>A URI specifying an external endpoint using the format scheme://[user:pass@]host[:port]/location[?parameters].</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:anyURI" />
            </xsd:simpleType>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="deliverToURL" substitutionGroup="gds:activity" type="gds:DeliverToURLType" />
  <!-- SQL Query -->
  <xsd:complexType name="DataStoreType">
    <xsd:complexContent>
      <xsd:extension base="gds:ActivityType">
        <xsd:sequence>
          <xsd:choice>
            <xsd:sequence>
              <xsd:element maxOccurs="unbounded" minOccurs="1" name="item" type="xsd:string" />
            </xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="1" name="input" type="gds:ActivityInputType" />
          </xsd:choice>
          <xsd:element maxOccurs="1" minOccurs="1" name="itemCursor" type="gds:ActivityOutputType" />
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="dataStore" substitutionGroup="gds:activity" type="gds:DataStoreType" />
</xsd:schema>